#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

int main() {
    umask(0);
    int fd=open("log.txt",O_WRONLY|O_CREAT|O_APPEND,0664);
    if(fd<0)
    {
        perror("open");
        return 1;
    }
   // const char *s="write success\n";
   // const char *s="O_TRUNC success\n";
    const char *s="O_APPEND success\n";
    write(fd,s,strlen(s));
    printf("open success,fd:%d\n",fd);
    close(fd);
}
